<?php
namespace app\api\controller;
use app\api\controller\BaseControllerLizhili;
use app\api\model\User;
use think\facade\Db;
use lizhili\Time;

class Shop extends BaseControllerLizhili
{
    public function index()
    {
        $data=input('post.');
        $lizhili=BaseController::lizhili($data);
		if($lizhili['code']!=0){
			return json($lizhili);
		}
		$validate = \think\facade\Validate::rule([
		    'name'  => 'require|max:25',
		    'email' => 'email'
		]);
		if (!$validate->check($data)) {
			return json(['code'=>400,'message'=>$validate->getError()]);
		}
		
		$user_model=new User();
        $user=$user_model->where('token',$data['token'])->find();
		if($user=$user_model->where('token',$data['token'])->find()){
			return json(['code'=>200,'message'=>'成功','data'=>$user]);
		}else{
			return json(['code'=>400,'message'=>'失败']);
		}
    }
}
